<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Programming language implementation</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Programming_language_implementation"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Programming_language_implementation rootpage-Programming_language_implementation skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Programming language implementation</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<p>In <a href="Computer_programming" title="Computer programming">computer programming</a>, a <b>programming language implementation</b> is a system for executing <a href="Computer_programs" class="mw-redirect" title="Computer programs">computer programs</a>. There are two general approaches to programming language implementation:<sup id="cite_ref-RantaBook_1-0" class="reference"><a href="#cite_note-RantaBook-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
</p>
<ul><li><i><a href="Interpreter_(computing)" title="Interpreter (computing)">Interpretation</a>:</i> The program is read as input by an interpreter, which performs the actions written in the program.<sup id="cite_ref-LanguageGreg_2-0" class="reference"><a href="#cite_note-LanguageGreg-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup></li>
<li><i><a href="Compiler" title="Compiler">Compilation</a>:</i> The program is read by a compiler, which translates it into some other language, such as <a href="Bytecode" title="Bytecode">bytecode</a> or <a href="Machine_code" title="Machine code">machine code</a>. The translated code may either be directly <a href="Execution_(computing)" title="Execution (computing)">executed</a> by hardware or serve as input to another interpreter or another compiler.<sup id="cite_ref-LanguageGreg_2-1" class="reference"><a href="#cite_note-LanguageGreg-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup></li></ul>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Interpreter">Interpreter</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1236090951">
/* start https://en.wikipedia.org/ */
.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}
/* end https://en.wikipedia.org/ */
</style><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="Interpreter_(computing)" title="Interpreter (computing)">Interpreter (computing)</a></div>
<p>An <a href="Interpreter_(computing)" title="Interpreter (computing)">interpreter</a> is composed of two parts: a <a href="Parser" class="mw-redirect" title="Parser">parser</a> and an <a href="Evaluator" class="mw-redirect" title="Evaluator">evaluator</a>. After a program is read as input by an interpreter, it is processed by the parser. The parser breaks the program into <a href="Syntax_(programming_languages)" title="Syntax (programming languages)">language components</a> to form a <a href="Parse_tree" title="Parse tree">parse tree</a>. The evaluator then uses the parse tree to execute the program.<sup id="cite_ref-IntroToComputing_3-0" class="reference"><a href="#cite_note-IntroToComputing-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading3"><h3 id="Virtual_machine">Virtual machine</h3></div>
<p>A <a href="Virtual_machine" title="Virtual machine">virtual machine</a> is a special type of interpreter that interprets bytecode.<sup id="cite_ref-LanguageGreg_2-2" class="reference"><a href="#cite_note-LanguageGreg-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> Bytecode is a <a href="Cross-platform_software" title="Cross-platform software">portable</a> low-level code similar to machine code, though it is generally executed on a virtual machine instead of a physical machine.<sup id="cite_ref-MakeUseOfVM_4-0" class="reference"><a href="#cite_note-MakeUseOfVM-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup> To improve their efficiencies, many programming languages such as <a href="Java_(programming_language)" title="Java (programming language)">Java</a>,<sup id="cite_ref-MakeUseOfVM_4-1" class="reference"><a href="#cite_note-MakeUseOfVM-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup> <a href="Python_(programming_language)" title="Python (programming language)">Python</a>,<sup id="cite_ref-PythonBytecode_5-0" class="reference"><a href="#cite_note-PythonBytecode-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup> and <a href="C_Sharp_(programming_language)" title="C Sharp (programming language)">C#</a><sup id="cite_ref-CLR_6-0" class="reference"><a href="#cite_note-CLR-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup> are compiled to bytecode before being interpreted.
</p>
<div class="mw-heading mw-heading3"><h3 id="Just-in-time_compiler">Just-in-time compiler</h3></div>
<p>Some virtual machines include a <a href="Just-in-time_compilation" title="Just-in-time compilation">just-in-time (JIT) compiler</a> to improve the efficiency of bytecode execution. While the bytecode is being executed by the virtual machine, if the JIT compiler determines that a portion of the bytecode will be used repeatedly, it compiles that particular portion to machine code. The JIT compiler then stores the machine code in <a href="Random-access_memory" title="Random-access memory">memory</a> so that it can be used by the virtual machine. JIT compilers try to strike a balance between longer compilation time and faster execution time.<sup id="cite_ref-LanguageGreg_2-3" class="reference"><a href="#cite_note-LanguageGreg-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="Compiler">Compiler</h2></div>
<div role="note" class="hatnote navigation-not-searchable">Main article: <a href="Compiler" title="Compiler">Compiler</a></div>
<p>A <a href="Compiler" title="Compiler">compiler</a> translates programs written in one language into another language. Most compilers are organized into three stages: a <a href="Compiler#Front_end" title="Compiler">front end</a>, an <a href="Compiler#Middle_end" title="Compiler">optimizer</a>, and a <a href="Compiler#Back_end" title="Compiler">back end</a>. The front end is responsible for understanding the program. It makes sure a program is valid and transforms it into an <a href="Intermediate_representation" title="Intermediate representation">intermediate representation</a>, a data structure used by the compiler to represent the program. The optimizer improves the intermediate representation to increase the speed or reduce the size of the <a href="Executable" title="Executable">executable</a> which is ultimately produced by the compiler. The back end converts the optimized intermediate representation into the output language of the compiler.<sup id="cite_ref-EngineeringCompiler_7-0" class="reference"><a href="#cite_note-EngineeringCompiler-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup>
</p><p>If a compiler of a given <a href="High_level_language" class="mw-redirect" title="High level language">high level language</a> produces another high level language, it is called a <a href="Source-to-source_compiler" title="Source-to-source compiler">transpiler</a>. Transpilers can be used to extend existing languages or to simplify compiler development by exploiting <a href="Software_portability" title="Software portability">portable</a> and well-optimized implementations of other languages (such as <a href="C_(programming_language)" title="C (programming language)">C</a>).<sup id="cite_ref-LanguageGreg_2-4" class="reference"><a href="#cite_note-LanguageGreg-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
</p><p>Many combinations of interpretation and compilation are possible, and many modern programming language implementations include elements of both. For example, the <a href="Smalltalk" title="Smalltalk">Smalltalk</a> programming language is conventionally implemented by compilation into <a href="Bytecode" title="Bytecode">bytecode</a>, which is then either interpreted or compiled by a <a href="Virtual_machine" title="Virtual machine">virtual machine</a>. Since Smalltalk bytecode is run on a virtual machine, it is portable across different hardware platforms.<sup id="cite_ref-SmalltalkBook_8-0" class="reference"><a href="#cite_note-SmalltalkBook-8"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="Multiple_implementations">Multiple implementations</h2></div>
<p>Programming languages can have multiple implementations. Different implementations can be written in different languages and can use different methods to compile or interpret code. For example, implementations of <a href="Python_(programming_language)" title="Python (programming language)">Python</a> include:<span style="white-space: nowrap;"> </span><sup id="cite_ref-AltPython_9-0" class="reference"><a href="#cite_note-AltPython-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup>
</p>
<ul><li><a href="CPython" title="CPython">CPython</a>, the <a href="Reference_implementation" title="Reference implementation">reference implementation</a> of Python</li>
<li><a href="IronPython" title="IronPython">IronPython</a>, an implementation targeting the <a href=".NET_Framework" title=".NET Framework">.NET Framework</a> (written in <a href="C_Sharp_(programming_language)" title="C Sharp (programming language)">C#</a>)</li>
<li><a href="Jython" title="Jython">Jython</a>, an implementation targeting the <a href="Java_virtual_machine" title="Java virtual machine">Java virtual machine</a></li>
<li><a href="PyPy" title="PyPy">PyPy</a>, an implementation designed for speed (written in RPython)</li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */
.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}
/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-RantaBook-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-RantaBook_1-0">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */
.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}
/* end https://en.wikipedia.org/ */
</style><cite id="CITEREFRanta2012" class="citation book cs1">Ranta, Aarne (February 6, 2012). <a rel="nofollow" class="external text" href="http://www.cse.chalmers.se/edu/year/2012/course/DAT150/lectures/plt-book.pdf#page=16"><i>Implementing Programming Languages</i></a> <span class="cs1-format">(PDF)</span>. College Publications. pp. <span class="nowrap">16–</span>18. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>9781848900646</bdi>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20201107224313/http://www.cse.chalmers.se/edu/year/2012/course/DAT150/lectures/plt-book.pdf#page=16">Archived</a> <span class="cs1-format">(PDF)</span> from the original on Nov 7, 2020<span class="reference-accessdate">. Retrieved <span class="nowrap">22 March</span> 2020</span>.</cite></span>
</li>
<li id="cite_note-LanguageGreg-2"><span class="mw-cite-backlink">^ <a href="#cite_ref-LanguageGreg_2-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-LanguageGreg_2-1"><sup><i><b>b</b></i></sup></a> <a href="#cite_ref-LanguageGreg_2-2"><sup><i><b>c</b></i></sup></a> <a href="#cite_ref-LanguageGreg_2-3"><sup><i><b>d</b></i></sup></a> <a href="#cite_ref-LanguageGreg_2-4"><sup><i><b>e</b></i></sup></a></span> <span class="reference-text"><cite id="CITEREFBaker" class="citation web cs1">Baker, Greg. <a rel="nofollow" class="external text" href="https://www2.cs.sfu.ca/~ggbaker/prog-langs/content/lang-implement.html">"Language Implementations"</a>. <i>Computing Science - Simon Fraser University</i>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20190308033517/http://www.cs.sfu.ca/~ggbaker/prog-langs/content/lang-implement.html">Archived</a> from the original on Mar 8, 2019<span class="reference-accessdate">. Retrieved <span class="nowrap">22 March</span> 2020</span>.</cite></span>
</li>
<li id="cite_note-IntroToComputing-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-IntroToComputing_3-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFEvans2011" class="citation book cs1">Evans, David (19 August 2011). <a rel="nofollow" class="external text" href="https://computingbook.org/FullText.pdf#page=221"><i>Introduction to Computing</i></a> <span class="cs1-format">(PDF)</span>. University of Virginia. p. 211<span class="reference-accessdate">. Retrieved <span class="nowrap">22 March</span> 2020</span>.</cite></span>
</li>
<li id="cite_note-MakeUseOfVM-4"><span class="mw-cite-backlink">^ <a href="#cite_ref-MakeUseOfVM_4-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-MakeUseOfVM_4-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><cite id="CITEREFSridhar2017" class="citation web cs1">Sridhar, Jay (Aug 29, 2017). <a rel="nofollow" class="external text" href="https://www.makeuseof.com/tag/why-java-virtual-machine-code-run-better/">"Why the Java Virtual Machine Helps Your Code Run Better"</a>. <i>MakeUseOf</i><span class="reference-accessdate">. Retrieved <span class="nowrap">22 March</span> 2020</span>.</cite></span>
</li>
<li id="cite_note-PythonBytecode-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-PythonBytecode_5-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFBennett2018" class="citation web cs1">Bennett, James (April 23, 2018). <a rel="nofollow" class="external text" href="https://opensource.com/article/18/4/introduction-python-bytecode">"An introduction to Python bytecode"</a>. <i>Opensource.com</i><span class="reference-accessdate">. Retrieved <span class="nowrap">22 March</span> 2020</span>.</cite></span>
</li>
<li id="cite_note-CLR-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-CLR_6-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFAli2017" class="citation web cs1">Ali, Mirza Farrukh (Oct 12, 2017). <a rel="nofollow" class="external text" href="https://medium.com/@mirzafarrukh13/common-language-runtime-dotnet-83e0218edcae">"Common Language Runtime(CLR) DotNet"</a>. <i>Medium</i><span class="reference-accessdate">. Retrieved <span class="nowrap">22 March</span> 2020</span>.</cite></span>
</li>
<li id="cite_note-EngineeringCompiler-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-EngineeringCompiler_7-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFCooperTorczon2011" class="citation book cs1">Cooper, Keith; Torczon, Linda (7 February 2011). <span class="id-lock-limited" title="Free access subject to limited trial, subscription normally required"><a rel="nofollow" class="external text" href="https://archive.org/details/engineeringcompi00coop_143"><i>Engineering a Compiler</i></a></span> (2nd ed.). Morgan Kaufmann. pp. <a rel="nofollow" class="external text" href="https://archive.org/details/engineeringcompi00coop_143/page/n238">6</a>-9. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>9780120884780</bdi>.</cite></span>
</li>
<li id="cite_note-SmalltalkBook-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-SmalltalkBook_8-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFLewis1995" class="citation book cs1">Lewis, Simon (May 11, 1995). <a rel="nofollow" class="external text" href="http://sdmeta.gforge.inria.fr/FreeBooks/Art/artAdded174186187Final.pdf#page=32"><i>The Art and Science of Smalltalk</i></a> <span class="cs1-format">(PDF)</span>. Prentice Hall. pp. <span class="nowrap">20–</span>21. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>9780133713459</bdi><span class="reference-accessdate">. Retrieved <span class="nowrap">23 March</span> 2020</span>.</cite></span>
</li>
<li id="cite_note-AltPython-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-AltPython_9-0">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.python.org/download/alternatives/">"Alternative Python Implementations"</a>. <i>Python.org</i><span class="reference-accessdate">. Retrieved <span class="nowrap">23 March</span> 2020</span>.</cite></span>
</li>
</ol></div></div>
<div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2></div>
<ul><li><span class="noviewer" typeof="mw:File"></span> Media related to <a href="https://commons.wikimedia.org/wiki/Category:Compiling_and_linking" class="extiw external" title="commons:Category:Compiling and linking">Compiling and linking</a> at Wikimedia Commons</li></ul></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-05-16" href="https://en.wikipedia.org/wiki/?title=Programming_language_implementation&oldid=1290693415">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
</body></html>